package cn.yanghan.client;

import cn.yanghan.doc.CourseDoc;
import cn.yanghan.utils.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class SearchServiceClientFalliback implements FallbackFactory<SearchServiceClient> {
    @Override
    public SearchServiceClient create(Throwable throwable) {
        return new SearchServiceClient() {
            @Override
            public AjaxResult add(CourseDoc courseDoc) {
                return AjaxResult.me().setSuccess(false).setMessage("搜索服务不可用");
            }
        };
    }
}
